<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 15-5-10
 * Time: 下午2:16
 */

class user extends adminBase{
    function __construct() {
        parent::__construct();
    }

    function loginoutTask(){
        $user=AdminModule::init('user');
        $user->logout();
        $webRouter=WebRouter::init();
        header("Location:".$webRouter->getPage("home","index"));
    }

    function gotoUpwardTask(){
        $user=AdminModule::init('user');
        $user->logout();
        $webRouter=WebRouter::init();
        header("Location:".$webRouter->getURL(".","home","index"));
    }

    function passwordTask(){
        $this->cms->formScene(array(),"admin/tpl/password.php");
    }

    function passwordSubmitTask($oldPassword,$newPassword,$repetPassword){
        if($newPassword==$repetPassword){
            $user_info=$this->user->getLoginInfo();
            $r['message']=$this->user->modifyPass($user_info['username'],$oldPassword,$newPassword);
        }else{
            $r['message']="新密码确认不匹配，请再次确认！";
        }
        View::displayAsHtml($r,"plugin/state/tips.php");
        $user=AdminModule::init('user');
        $user->logout();
    }
} 